<div class="wrapper-bz-page">
    <div class="wrapper-bz-filter">
        <div class="filter-item"><span><label>诗名:</label><input id="ele_input_poem_title_in_lib_poem_in_m51" class="easyui-textbox"
                                                                style="width:100px; height:25px;"/></span></div>
        <div class="filter-item"><span><label>朝代:</label><input id="ele_input_dynasty_in_lib_poem_in_m51" style="width:50px;" class="easyui-textbox"/></span></div>
        <div class="filter-item"><span><label>诗人:</label><input id="ele_input_poet_in_lib_poem_in_m51" class="easyui-textbox"
                                                                style="width:100px;" /></span></div>
        <div class="filter-item"><span><label>内容:</label><input id="ele_input_poem_content_in_lib_poem_in_m51"
                                                                class="easyui-textbox" style="width:200px;"/></span>
        </div>
        <button class="filter-btn" id="btn_search_lib_poem_in_m51"><i class="fa fa-search"></i>查询</button>
        <button class="filter-btn" id="btn_reset_lib_poem_in_m51"><i class="fa fa-repeat"></i>重置</button>
    </div>
    <div class="wrapper-bz-body has-upper-filter">
        <div class="column-block block-right" style="left:0px;">
            <div class="column-content no-column-title">
                <div class="column-datagrid no-filter">
                    <table id="table_lib_poem_in_m51" style="width:100%;height:100%"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="dialog_add_lib_poem_in_m51"></div>
<div id="dialog_edit_lib_poem_in_m51"></div>
<div id="box_view_lib_poem" class="box-pop hide"></div>

<script>
    $(function () {
        var listTable = [
            {subject_keyword: "lib_poem_in_m51", datagrid_code: "lib_poem_m51", three_column_width: ['add', 'edit']},
        ];

        var subjectKeyword = listTable[0].subject_keyword;
        var tableId = 'table_' + subjectKeyword
        var tableObject = $("#" + tableId);

        var searchBtnId = '#btn_search_' + subjectKeyword;
        var resetBtnId = '#btn_reset_' + subjectKeyword;

        var dialogId_1 = "dialog_add_" + subjectKeyword;
        var dialogId_2 = "dialog_edit_" + subjectKeyword;
        var dialogId_3 = "dialog_join_" + subjectKeyword;
        clearDialogHtml([dialogId_1, dialogId_2, dialogId_3]);

        var searchOption = {};
        var datagridConfigList = $(document).getDatagridConfig(listTable);
        var datagridConfig = datagridConfigList[0];
        var searchFieldSingleSelect = [];
        var searchFieldManySelect = [];
        var searchFieldInput = ['poem_title', 'poet', 'dynasty', 'poem_content'];

        initSelectField(subjectKeyword, searchFieldSingleSelect, searchFieldManySelect, searchOption);

        datagridConfig.queryParams = {content_type: 1};
        tableObject.datagrid(datagridConfig);

        $(searchBtnId).click(function () {
            var filterConfig = getFilterData(subjectKeyword, searchFieldInput, searchFieldSingleSelect, searchFieldManySelect);
            datagridConfig.queryParams = $.extend({content_type:1}, filterConfig);
            tableObject.datagrid(datagridConfig);
        });

        $(resetBtnId).click(function () {
            var filterConfig = clearFilterData(subjectKeyword, searchFieldInput, searchFieldSingleSelect, searchFieldManySelect);
            datagridConfig.queryParams = $.extend({content_type:1}, filterConfig);
            tableObject.datagrid(datagridConfig);
        });

        $(document).on("keyup", ".wrapper-filter input", function(e){
            if (13 == e.keyCode) {
                refreshTableList(subject, searchFieldSelect, searchFieldInput);
            }
        });



    });
</script>